/*** author: sailing date: 2018/10/23 ***/

<template>
	<div class="HomeContent">
		<mu-paper :z-depth="1" class="demo-list-wrap">
			<mu-list textline="three-line">
				
				<div v-for="el in foods">
					<mu-divider></mu-divider><br />
					<mu-list-item avatar :ripple="false" button>
						<mu-list-item-content>
							<mu-list-item-title>{{
								el.name
							}}</mu-list-item-title>
							<mu-list-item-sub-title>
								<mu-text-field
									v-model="el.text"
									type="string"
									placeholder=""
									icon=""
								></mu-text-field
								><br />
							</mu-list-item-sub-title>
						</mu-list-item-content>
						<mu-list-item-action>
							<mu-checkbox v-model="el.select"></mu-checkbox>
						</mu-list-item-action>
					</mu-list-item>
				</div>
			</mu-list>
		</mu-paper>

		</mu-paper><br/>
		<mu-paper :z-depth="1" class="demo-list-wrap">
			<timeSet :rtime = 'rtime'></timeSet>
		</mu-paper></br>

		<mu-paper style="display:block" :z-depth="1" class="demo-list-wrap">
			<mu-button style="text-align:left;margin-left:10px" @click="submit();" color="secondary">提交记录</mu-button>
		</mu-paper><br />
	</div>
</template>

<script type="text/javascript">
import carouselImg1 from "../assets/images/carousel1.jpg";
import carouselImg2 from "../assets/images/carousel2.jpg";
import carouselImg3 from "../assets/images/carousel3.jpg";
import carouselImg4 from "../assets/images/carousel4.jpg";
import food from "./symdata.js";
import timeSet from './time';
import fetch from "../server/fetch.js";
import Config from "../server/Config.js";
export default {
	data() {
		return {
			carouselImg1,
			carouselImg2,
			carouselImg3,
			carouselImg4,
			loading: false,
			active: 0,
			rtime:{
					start: '',
					end: ''
				},
			foods: food
		};
	},
	methods: {
		submit() {
			this.loading = true
			let dd = [];
			let postData = {
				title: "症状",
				user: Config.user,
				data:'',
				time: this.rtime,
			}
			for (var i = 0; i < this.foods.length; i++) {
				if (this.foods[i]["select"]) {
					dd.push({
						name: this.foods[i]["name"],
						text: this.foods[i]["text"]
					});
				}
			}
			postData['data'] = dd
			console.log(postData)
			fetch.POST({
				path: "/regist",
				data: postData,
				callback: function() {
					console.log("sendmail");
				}
			});
		}
	},
	components: {timeSet}
};
</script>

<style lang="less">
.HomeContent {
	.demo-list-wrap {
		width: 100%;
		
		overflow: hidden;
	}
	.ulstyle {
		.listyle {
			position: relative;
			.mu-carousel {
				height: 200px;
				margin-top: -20px;
			}
			img {
				min-width: 100%;
				width: 100%;
			}
			.bgtextbg {
				position: absolute;
				background: #000;
				width: 100%;
				bottom: 0;
				height: 40px;
				opacity: 0.5;
			}
			.bgtext {
				position: absolute;
				width: 100%;
				bottom: 0;
				text-align: left;
				color: #fff;
				height: 40px;
				line-height: 40px;
				margin-left: 20px;
			}
		}
		.textList {
			.textItem {
				min-height: 50px;
				line-height: 25px;
				-webkit-box-shadow: 1px 1px 1px #000;
				box-shadow: 0px 2px 4px #dddede;
				margin-top: 10px;
				text-align: left;
				display: -webkit-box;
				margin: 0 auto;
				margin-left: 10px;
				margin-right: 10px;

				.text {
					text-align: left;
				}
				img {
					height: 80px;
					margin-left: 5px;
				}
			}
		}
	}
}
</style>
